package com.nciae.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nciae.po.DormitorySecurityQuestion;
import com.nciae.po.HoursemasterSecurityQuestion;
import com.nciae.dao.HoursemasterSecurityQuestionMapper;
import com.nciae.service.IHoursemasterSecurityQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Guoliyu
 * @since 2022-04-24
 */
@Service
public class HoursemasterSecurityQuestionServiceImpl extends ServiceImpl<HoursemasterSecurityQuestionMapper, HoursemasterSecurityQuestion> implements IHoursemasterSecurityQuestionService {

    @Override
    public void add(HoursemasterSecurityQuestion hoursemasterSecurityQuestion) {
        baseMapper.insert(hoursemasterSecurityQuestion);
    }

    @Override
    public List<HoursemasterSecurityQuestion> findByHousemasterId(Long id) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("housemaster_id",id);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public List<HoursemasterSecurityQuestion> findBySecurityQuestionId(Long id) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("security_question_id",id);
        return baseMapper.selectList(wrapper);
    }
}
